import React from 'react';
import { Balloon } from '@teamix/ui';
import docs from 'utils/docs';
import { getFeature } from 'utils/features';
import intl from '../../../../../../../../../../locale';

export default class CloneToolTip extends React.Component {
  render() {
    const { disabled, trigger, isAliyunGray, ...rest } = this.props;
    if (!disabled) {
      return trigger;
    }

    return (
      <Balloon.Tooltip
        align="tl"
        type={isAliyunGray ? 'normal' : 'primary'}
        trigger={trigger}
        {...rest}
      >
        {getFeature('project.setting.clone_download_control.need_apply') && isAliyunGray ? (
          <div>
            {intl.get({
              id: 'code-assets.containers.baseForm.cloneTooltip.AdvancedFeaturesInInternalTesting',
              defaultMessage: '高级功能内测中，支持',
            })}
            <a href={docs('clone-download-contro')} traget="_blank">
              {intl.get({
                id: 'code-assets.containers.baseForm.cloneTooltip.SubmitATicket',
                defaultMessage: '提交工单',
              })}
            </a>
            {intl.get({
              id: 'code-assets.containers.baseForm.cloneTooltip.ApplyForUse',
              defaultMessage: '申请使用',
            })}
          </div>
        ) : (
          intl.get({
            id: 'code-assets.containers.baseForm.cloneTooltip.PleaseContactTheEnterpriseAdministrator',
            defaultMessage: '请联系企业管理员在企业设置中修改',
          })
        )}
      </Balloon.Tooltip>
    );
  }
}
